import unittest
import datetime
from InterfaceTest.common.HTMLTestRunner_2 import HTMLTestRunner
from InterfaceTest.testcase.TestCase_Demo import DataTest
from InterfaceTest.testcase.TestCase_Demo import DaTa2Test


if __name__ == "__main__":
    # 构建测试集
    suite1 = unittest.TestLoader().loadTestsFromTestCase(DataTest)
    suite2 = unittest.TestLoader().loadTestsFromTestCase(DaTa2Test)
    suite = unittest.TestSuite(tests=[suite1, suite2])
    # 设置测试报告路径+名称
    now = datetime.datetime.now().strftime("%Y-%m-%d %H_%M_%S")
    filePath = './result/' + now + "Result.html"
    print(filePath)
    fp = open(filePath, 'wb')
    # tester 测试人员名称, title 测试报告标题, description 测试情况描述
    # 不输入采用默认值
    runner = HTMLTestRunner(stream=fp, verbosity=2, title='随便测试', description='新版本')
    runner.run(suite1)
